package c.j.a.c.g$d;

import android.app.Activity;
import android.app.Dialog;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.View;
import c.j.a.c.b;
import c.j.a.c.c;
import c.j.a.c.d;
import c.j.a.c.g.y;
import c.j.a.c.g.z;
import c.j.a.c.o;
import c.j.a.d.b.e.i;
import c.j.a.d.b.j.a0;
import java.util.Objects;

/* compiled from: ReverseWifiDialog */
public class g extends Dialog {
    public View a = findViewById(b.d);
    public View b = findViewById(b.c);
    public d c;
    public boolean d;
    public Activity e;

    public g(Activity activity, d dVar) {
        super(activity, d.a);
        this.e = activity;
        this.c = dVar;
        setCancelable(false);
        setContentView(LayoutInflater.from(this.e.getApplicationContext()).inflate(c.b, null));
        this.a.setOnClickListener(new e(this));
        this.b.setOnClickListener(new f(this));
    }

    public void dismiss() {
        o.b bVar = o.b.b.a;
        super.dismiss();
        if (!this.e.isFinishing()) {
            this.e.finish();
        }
        z zVar;
        com.ss.android.socialbase.downloader.g.c k;
        if (this.d) {
            zVar = (z) this.c;
            Objects.requireNonNull(zVar);
            y.l = null;
            k = i.a(y.a()).k(zVar.a);
            if (k != null) {
                k.N();
                try {
                    k.C0.put("pause_reserve_on_wifi", 3);
                    k.U();
                } catch (Exception unused) {
                }
                a0.a().c(k);
                bVar.i("pause_reserve_wifi_confirm", zVar.b);
                return;
            }
            return;
        }
        zVar = (z) this.c;
        Objects.requireNonNull(zVar);
        y.l = null;
        k = i.a(y.a()).k(zVar.a);
        if (k != null) {
            k.j();
        }
        bVar.i("pause_reserve_wifi_cancel", zVar.b);
    }

    public boolean dispatchKeyEvent(KeyEvent keyEvent) {
        if (keyEvent.getKeyCode() == 4) {
            return true;
        }
        return super.dispatchKeyEvent(keyEvent);
    }
}
